//精品、最新、全部课程
function bna(type,obj) {
	$.ajax({
		url : baselocation + "/index/ajax/bna",
		data : {
			"order" : type
		},
		type : 'post',
		dataType : 'text',
		beforeSend:function(){
			$("#bna").html(lodingHtml);
			clearTimeout(_timer);
		},
		success : function(result) {
			$(obj).addClass("current").siblings().removeClass("current");
			_timer = setTimeout(function(){
				$("#bna").html(result);
				scrollLoad(); // 调用 滚动记载图片方法
			}, 300);
		}
	});
}
/**
 * 	获取网校名师
 */
function getfamousteachers(){
	$.ajax({
		type:"post",
		url:"http://127.0.0.1:8080/inxweb/index/famousteachers",
		success:function(data){
			if(data.success){
				var html = '';
				if(data.entity!=null && data.entity!=""){
					$.each(data.entity, function(index,value) {
						html += "<li>"+
									"<section class='i-teach-wrap'>"+
										"<div class='i-teach-pic'>"+
											"<a href='http://localhost:8081/front/teacher/83' title='"+value.name+"'>"+
												"<img alt='"+value.name+"' src='http://localhost:8080/"+value.pic_path+"'>"+
												"</a>"+
										"</div>"+
										"<div class='mt10 hLh30 txtOf tac'>"+
											"<a href='javascript:void(0)' onclick='toping("+value.id+")' title='"+value.name+"' class='fsize18 c-666'>"+value.name+"</a>"+
										"</div>"+
										"<div class='hLh30 txtOf tac'>"+
											"<span class='fsize14 c-999'>"+value.education+"</span>"+
										"</div>"+
										"<div class='mt15 i-q-txt'>"+
											"<p class='c-999 f-fA'>"+value.career+"</p>"+
										"</div>"+
									"</section>"+
								"</li>"
					});
					$("#famousteacher").append(html);
				}
			}else{
				alert(data.message);
			}
		}
	});
}

				/**
				 * 根据id查询教师详情
				 * @param {Object} id
				 */
					function toping(id){		
							$.cookie('id',id)
		                	window.location.href="Getteacher.html";
						}
/**
 * 	获取课程互动
 */
function getCourseinteractions(){
	$.ajax({
		type:"post",
		url:"http://127.0.0.1:8080/inxweb/index/courseinteractions",
		success:function(data){
			if(data.success){
				var html = '';
				if(data.entity!=null && data.entity!=""){
					$.each(data.entity, function(index,value) {
						$.each(value.user, function(i,v) {
							$.each(value.courses,function(ci,cv){
								html += "<li>"+
									"<section class='i-q-l-wrap'>"+
										"<div class='u-face'>"+
											"<img width='50' height='50' class='picImg' src='http://localhost:8080/"+v.pic_img+"'>"+
											"</div>"+
										"<section class='hLh20 of'>"+
											"<span class='fr'><tt class='c-ccc f-fG'>"+getMyDate(value.addtime)+"</tt></span> "+
											"<span class='fsize16 c-666'>"+v.show_name+"</span> "+
										    "<span class='fsize14 c-999 ml5 f-fA'>评论课程：</span>"+
										"</section>"+
										"<section class='hLh20 of mt10'>"+
											"<a class='c-master fsize14' href='http://localhost:8081/front/couinfo/10'>"+cv.course_name+"</a>"+
										"</section>"+
										"<section class='i-q-txt'>"+
											"<p>"+
												"<span class='c-999 f-fA txtOf'> "+value.content+"</span>"+
											"</p>"+
										"</section>"+
									"</section>"+
								"</li>";
							});
						});
					});
					$("#iQuestion").append(html);
				}
			}else{
				alert(data.message);
			}
		}
	});
}
/**
 *  网校课程
 */
function getCourses(){
	$.ajax({
		type:"post",
		url:"http://127.0.0.1:8080/inxweb/index/course",
		success:function(data){
			if(data.success){
				var html = '';
				if(data.entity!=null && data.entity!=""){
					$.each(data.entity, function(index,value) {
						html += "<li>"+ 
								"<div class='cc-l-wrap'>"+
									"<section class='course-img'>";
					if(value.logo!=null && value.logo!=""){
						html += "<img  src='../webapp"+value.logo+"' class='img-responsive'>";
					}
					if(value.logo==null || value.logo==""){
						html += "<img xSrc='static/inxweb/img/default-img.gif' src='static/inxweb/img/default-img.gif' class='img-responsive' alt='"+value.course_name+"'>";
					}
					
						html +=				"<div class='cc-mask'>"+
											"<a href='javascript: void(0)' onclick='course_id("+value.course_id+")' title='开始学习' class='comm-btn c-btn-1'>开始学习</a>"+
										"</div>"+
									"</section>"+
									"<h3 class='hLh30 txtOf mt10'>"+
										"<a href='http://127.0.0.1:8020/front/couinfo/1' title='"+value.course_name+"' class='course-title fsize18 c-333'>"+value.course_name+"</a>"+
									"</h3>"+
									"<section class='mt10 hLh20 of'>";
					if(value.current_price=="0.00" || value.current_price!="0"){
						html += 			"<span class='fr jgTag bg-green'><tt class='c-fff fsize12 f-fA'>免费</tt></span>";
					}
					if(value.current_price!="0.00" && value.current_price!="0"){
						html += 			"<span class='fr jgTag bg-orange'><tt class='c-fff fsize14 f-fG'>￥"+value.current_price+"</tt></span>";
					}
						html +=				"<span class='fl jgAttr c-ccc f-fA'> <tt class='c-999 f-fA'>";
					if(value.current_price=="0.00" || value.current_price=="0"){
						html += 			value.page_viewcount;
					}
					if(value.current_price!="0.00" && value.current_price!="0"){
						html += 			value.page_buycount;
					}
						html +=					"人学习"+
											"</tt> | <tt class='c-999 f-fA'>";
					if(value.current_price=="0.00" || value.current_price=="0"){
						html += 			value.page_viewcount;
					}
					if(value.current_price!="0.00" && value.current_price!="0"){
						html += 			value.page_viewcount;
					}						
						html += 				"评论"+
											"</tt>"+
										"</span>"+
									"</section>"+
								"</div>"+
							"</li>";
					});
				}
			}else{
				alert(data.message);
			}
			$("#bna1").append(html);
		}
	});
}

/**
 * 根据id查询课程详情
 */
									function course_id(id) {
											$.cookie('id1',id,{path:'/'})
											window.location.href='../FSX_kechen/course-video1.html';
										}

/**
 *  网校课程
 */
function getStudynamics(){
	$.ajax({
		type:"post",
		url:"http://127.0.0.1:8080/inxweb/index/studynamics",
		success:function(data){
			if(data.success){
				var html = '';
				if(data.entity!=null && data.entity!=""){
					$.each(data.entity, function(index,value) {
						html += "<li>"+
									"<div class='u-face'>";
					if(value.pic_img!=null && value.pic_img!=""){
						html += 			"<img src='http://localhost:8080/"+value.pic_img+"' width='50' height='50' alt=''>";
					}
					if(value.pic_img==null || value.pic_img==""){
						html += 			"<img src='../static/inxweb/img/avatar-boy.gif' width='50' height='50' alt=''>";
					}
						html +=		"</div>"+
									"<section class='hLh30 txtOf'>"+
										"<span class='c-ccc fr'>"+getMyDate(value.update_time)+"</span>"+
										"<span class='c-333 fsize16 fl'>"+value.show_name+
										"</span> "+
									"</section>"+
									"<section class='hLh20 txtOf'>"+
										"<span class='c-999'>播放了</span> <span class='c-master'>"+value.course_name+"</span>"+
									"</section>"+
								"</li>";
					});
					$("#Studynamics").append(html);
				}
			}else{
				alert(data.Message);
			}
		}
	});
}

/**
 * 把毫秒转换为("yyyy-MM-dd hh:mm:ss")格式
 */
function getMyDate(str){
	var oDate = new Date(str),
	oYear = oDate.getFullYear(),
	oMonth = oDate.getMonth()+1,
	oDay = oDate.getDate(),
	oHour = oDate.getHours(),
	oMin = oDate.getMinutes(),
	oSen = oDate.getSeconds(),
//	oTime = oYear +'/'+ getzf(oMonth) +'/'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间
	oTime = oYear +'/'+ getzf(oMonth) +'/'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin);//最后拼接时间
	return oTime;
};
//补0操作
function getzf(num){
	if(parseInt(num) < 10){
		num = '0'+num;
	}
	return num;
}










/*<li> 
	<div class="cc-l-wrap">
		<section class="course-img">
			<!--<c:if test="${not empty course_bna.logo&& course_bna.logo!=''}">-->
				<img xSrc="" src="http://127.0.0.1:8020/static/inxweb/img/default-img.gif" class="img-responsive" alt="courseName">
			<!--</c:if>-->
			<!--<c:if test="${empty course_bna.logo||course_bna.logo=='' }">-->
				<img xSrc="http://127.0.0.1:8020/static/inxweb/img/default-img.gif" src="http://127.0.0.1:8020/static/inxweb/img/default-img.gif" class="img-responsive" alt="222222222222">
			<!--</c:if>-->
			<div class="cc-mask">
				<a href="http://127.0.0.1:8020/front/couinfo/3" title="开始学习2" class="comm-btn c-btn-1">开始学习1</a>
			</div>
		</section>
		<h3 class="hLh30 txtOf mt10">
			<a href="http://127.0.0.1:8020/front/couinfo/1" title="courseName" class="course-title fsize18 c-333">courseName</a>
		</h3>
		<section class="mt10 hLh20 of">
			<!--<c:if test="${course_bna.currentPrice=='0.00' }">-->
				<span class="fr jgTag bg-green"><tt class="c-fff fsize12 f-fA">免费</tt></span>
			<!--</c:if>-->
			<!--<c:if test="${course_bna.currentPrice!='0.00' }">-->
				<span class="fr jgTag bg-orange"><tt class="c-fff fsize14 f-fG">￥currentPrice</tt></span>
			<!--</c:if>-->
			<span class="fl jgAttr c-ccc f-fA"> <tt class="c-999 f-fA">
					<!--<c:if test="${course_bna.currentPrice=='0.00' }">-->
						pageViewcount
					<!--</c:if>-->
					<!--<c:if test="${course_bna.currentPrice!='0.00' }">-->
						pageBuycount
					<!--</c:if>-->
					人学习
				</tt> | <tt class="c-999 f-fA">
					<!--<c:if test="${course_bna.currentPrice=='0.00' }">-->
						pageViewcount
					<!--</c:if><c:if test="${course_bna.currentPrice!='0.00' }">-->
						pageViewcount
					<!--</c:if>-->
					评论
				</tt>
			</span>
		</section>
	</div>
</li>*/



/*<li>
		<div class="u-face">
			<c:if test="${empty courseStudyhistory.picImg}">
				<img src="${ctx }/static/inxweb/img/avatar-boy.gif" width="50" height="50" alt="">
			</c:if>
			<c:if test="${!empty courseStudyhistory.picImg}">
				<img src="<%=staticImage%>${courseStudyhistory.picImg }" width="50" height="50" alt="">
			</c:if>
		</div>
		<section class="hLh30 txtOf">
			<span class="c-ccc fr">${courseStudyhistory.updateTimeFormat }</span>
			<span class="c-333 fsize16 fl">${courseStudyhistory.showName}
			</span> 
		</section>
		<section class="hLh20 txtOf">
			<span class="c-999">播放了</span> <span class="c-master">“${courseStudyhistory.courseName }”</span>
		</section>
	</li> */



